package cn.com.thingo.shyintelligent.ui.adapter;


import android.view.SurfaceView;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.bumptech.glide.GlideBuilder;
import com.chad.library.adapter.base.BaseMultiItemQuickAdapter;

import com.chad.library.adapter.base.BaseViewHolder;
import com.chad.library.adapter.base.entity.MultiItemEntity;
import com.videogo.openapi.EZOpenSDK;
import com.videogo.openapi.EZPlayer;
import com.videogo.openapi.bean.EZDeviceInfo;

import java.util.List;

import cn.com.thingo.shyintelligent.R;
import cn.com.thingo.shyintelligent.ui.adapter.adapterentity.DeviceItemEntity;


public class MonitorAdapter extends BaseMultiItemQuickAdapter<MultiItemEntity, BaseViewHolder> {
    public static final int ITEM_ROOM = 1;
    public static final int ITEM_ADD = 2;


    /**
     * Same as QuickAdapter#QuickAdapter(Context,int) but with
     * some initialization data.
     *
     * @param data A new list is created out of this one to avoid mutable list
     */
    public MonitorAdapter(List<MultiItemEntity> data) {
        super(data);
        addItemType(ITEM_ROOM, R.layout.item_monitor_rec);
        addItemType(ITEM_ADD, R.layout.item_camera_add);
    }

    @Override
    protected void convert(BaseViewHolder helper, MultiItemEntity item) {
        int itemType = item.getItemType();
        switch (itemType) {
            case ITEM_ROOM:
                EZDeviceInfo ezDeviceInfo = ((DeviceItemEntity) item).getEZDeviceInfo();
                helper.setText(R.id.tv_room, ezDeviceInfo.getDeviceName());
                ImageView imageView = helper.getView(R.id.iv_device);
                Glide.with(mContext).load(ezDeviceInfo.getDeviceCover()).into(imageView);
                break;
        }
    }


}
